package com.xiaoshuidi.cloud.module.iot.enums;

/**
 * 尖峰平谷类型 转换
 * spike-peak-plain-valley
 */
public enum PeakValleyEnum {

    NORMAL("NORMAL", "常规"),
    SPIKE("SPIKE", "尖"),
    PEAK("PEAK", "峰"),
    PLAIN("PLAIN", "平"),
    VALLEY("VALLEY", "谷"),
    OTHER("OTHER", "其他");

    private String code;
    private String desc;

    PeakValleyEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    /**
     * 从雷优转换成本地
     * @param leiYouType 对应雷优的 identifier
     * @return
     */
    public static PeakValleyEnum convertFromLeiYou(String leiYouType) {
        if ("122".equals(leiYouType)) {
            return PeakValleyEnum.SPIKE;
        }
        if ("123".equals(leiYouType)) {
            return PeakValleyEnum.PEAK;
        }
        if ("124".equals(leiYouType)) {
            return PeakValleyEnum.PLAIN;
        }
        if ("125".equals(leiYouType)) {
            return PeakValleyEnum.VALLEY;
        }
        if ("11X".equals(leiYouType)) {
            return PeakValleyEnum.NORMAL;
        }
        return PeakValleyEnum.OTHER;
    }
}
